﻿/*******************************************************************************
* Copyright (C) JuCheap
* 
* Author: dj.wong
* Create Date: 09/04/2015 11:47:14
* Description: Automated building by service@jucheap.com 
* 
* Revision History:
* Date         Author               Description
*
*********************************************************************************/

using Microsoft.Extensions.Configuration;

namespace JuCheap.Core.Infrastructure.Extentions
{
    /// <summary>
    ///     配置文件扩展方法类
    /// </summary>
    public static class ConfigurationExtentions
    {
        /// <summary>
        /// 获取Ids服务地址
        /// </summary>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public static string GetIdentityServerUrl(this IConfiguration configuration)
        {
            return configuration.GetSection("IdentityServerUrl").Value;
        }

        /// <summary>
        /// 获取Api的key
        /// </summary>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public static string GetApiId(this IConfiguration configuration)
        {
            return configuration.GetSection("Api:Id").Value;
        }

        /// <summary>
        /// 获取Api的密钥
        /// </summary>
        /// <param name="configuration"></param>
        /// <returns></returns>
        public static string GetApiSecret(this IConfiguration configuration)
        {
            return configuration.GetSection("Api:Secret").Value;
        }
    }
}